// Pixel shader Gouraud Shading - Per-vertex lighting
precision mediump float;

// texture variables
uniform sampler2D texture1; // color texture

varying vec2 tCoord;
varying lowp vec4 colorVarying;
varying vec4 clippingVarying;
 
void main() {
	if (clippingVarying.z == -1.0 && clippingVarying.w == -1.0) {
		gl_FragColor = texture2D(texture1, tCoord) * colorVarying;
	} else {
		if (gl_FragCoord.x < clippingVarying.x || gl_FragCoord.x > clippingVarying.z) {
			gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
		} else if (gl_FragCoord.y < clippingVarying.y || gl_FragCoord.y > clippingVarying.w) {
			gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
		} else {
			gl_FragColor = texture2D(texture1, tCoord) * colorVarying;
		} 
	}

	//gl_FragColor = vec4(1,1,1,1);
}


